package com.yesun.dcm.rpc.protocol;

import com.yesun.dcm.commons.rpc.URL;
import com.yesun.dcm.rpc.RpcRequest;
import com.yesun.dcm.remote.netty.NettyClient;
import com.yesun.dcm.rpc.RpcResponse;


public class DcmInvoker<T> extends AbstractInvoker<T> {

    public DcmInvoker(Class<T> type, URL url) {
        super(type, url);
    }

    @Override
    protected RpcResponse doInvoke(RpcRequest request) {
        RpcResponse response = null;
        try {
            response = new NettyClient(url.getHost(), url.getPort()).send(request);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
}
